﻿using GC_RF.BusinessEntities.DTOs;
using GC_RF.Domain.Constants;
using GC_RF.Domain.Factories;
using GC_RF.Domain.Helpers;
using GC_RF.Site.Abstractions.Interfaces.Resources;

namespace GC_RF.Site.Resources
{
	public class AppContext : IAppContext
	{
		#region Static Members

		public static IAppContext Current
		{
			get { return (AppContext)ContextFactory.GetHttpContext().Items[Keys.AppContext]; }
			set { ContextFactory.GetHttpContext().Items[Keys.AppContext] = value; }
		}

		#endregion

		#region IAppContext Members

		public UserData CurrentUser
		{
			get { return SessionManager.Contains(Keys.User) ? SessionManager.Get<UserData>(Keys.User) : null; }
			set { SessionManager.Set(Keys.User, value); }
		}

		#endregion
	}
}